package com.gzgy.ustore.api.common.util;


import com.tencent.xinge.XingeApp;
import org.json.JSONObject;

public class PushUtil {

    public static String pushTokenAndroid(Long accessId, String secretKey, String title, String message, String token) {
        JSONObject object = XingeApp.pushTokenAndroid(accessId, secretKey, title, message, token);
        //推送成功
        if ("0".equals(object.get("ret_code").toString())) {
            return "发送信息成功";
        }else{
            return object.get("err_msg").toString();
        }
    }

    public static String pushAllAndroid(Long accessId, String secretKey, String title, String message) {
        JSONObject object = XingeApp.pushAllAndroid(accessId, secretKey, title, message);
        //System.out.println(object.get("ret_code").toString().equals("0"));
        //推送成功
        if ("0".equals(object.get("ret_code").toString())) {
            return "发送信息成功";
        }else{
            return object.get("err_msg").toString();
        }
    }

    public static void main(String[] args) {
       // pushTokenAndroid(2100262431L,"f52356a13fcca0c2835bf3e67026fda3","1asdas1","22","7db569f49eac69544b5a9785b1b97e319c276411");
        pushAllAndroid(2100262431L,"f52356a13fcca0c2835bf3e67026fda3","11","所有的");
    }
}
